<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <title>我的通讯录</title>
    <style>
        h1,th{ color:red;}
        table{
            border: 5px double red;
            width: 500px;
        }
        th,td{
            border-bottom: 1px dotted red;
            border-right: 1px dotted red;
            padding: 8px;
        }
    </style>
</head>
<body>
<h1>我的通讯录</h1>
<table>
    <tr><th>学号</th><th>姓名</th><th>电话</th></tr>
    <?php
    $db = new PDO('mysql:host=localhost; dbname=db', 'root', '12qwas');
    $ps=$ps=$db->query('select * from students order by xh');
    while($r=$ps->fetch(PDO::FETCH_ASSOC)){
        echo "<tr><td>{$r['xh']}</td><td>{$r['name']}</td><td>{$r['tel']}</td></tr>";
    }
    ?>
</table>
</body>
</html>
